﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LibFriesland_Campina_CRM;

public partial class ChangePassword : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["account"] == null)
            Response.Redirect("login.aspx");
    }

    protected void btnChangePassword_Click(object sender, EventArgs e)
    {
        string username = ((BizAccount)Session["account"]).username;
        int status = BizAccount.changePassword(username, txtOldPass.Text, txtNewPass.Text);
        if (status == 1)
        {
            Response.Write("<script>alert('" + "Thay đổi mật khẩu thành công !" + "')</script>");
            Session["account"] = null;
            //Response.Redirect("login.aspx");
        }
        else
            Response.Write("<script>alert('" + "Mật khẩu cũ không đúng !" + "')</script>");

    }
}